

<template>
  <h1>后台首页</h1>
  <pug-dialog  @saveBtn="hanlderSave"></pug-dialog>
  <pug-num ref="numRef"></pug-num>
  <h1>获取num-User:{{user}}</h1>
  <button @click="hanlderNum">Num++</button>
</template>

<script setup>
  import PugDialog from "@/父子组件/PugDialog.vue";
  import {ref,onMounted} from "vue";
  import PugNum from "@/components/PugNum.vue";
  const numRef = ref(null);
  const user = ref({});
  const hanlderSave = (content) => {
    console.log("保存...",content);
  }
  //生命周期
  onMounted(() => {
    user.value = numRef.value.user;
  })
  const hanlderNum = ()=>{
    numRef.value.hanlderClick();
  }
</script>